package com.dj.persistence.entity;

import javax.persistence.Embeddable;
import javax.persistence.Column;
import javax.persistence.Embedded;

@Embeddable
public class Address {
    @Column(name="DOOR_NO")
    private String doorNo;
    @Column(name="STREET_NAME")
	private String streetName;
    @Column(name="AVENUE")
	private String avenue;
    @Column(name="CITY")
	private String city;
    @Column(name="STATE")
	private String state;
    @Column(name="COUNTRY")
	private String country;
    @Column(name="PIN")
	private String pin;
    @Embedded
	private PhoneNumber landlineNo;
//    @Embedded
//	private PhoneNumber mobileNo;

	public String getDoorNo() {
		return doorNo;
	}

	public void setDoorNo(String doorNo) {
		this.doorNo = doorNo;
	}

	public String getStreetName() {
		return streetName;
	}

	public void setStreetName(String streetName) {
		this.streetName = streetName;
	}

	public String getAvenue() {
		return avenue;
	}

	public void setAvenue(String avenue) {
		this.avenue = avenue;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getPin() {
		return pin;
	}

	public void setPin(String pin) {
		this.pin = pin;
	}

	public PhoneNumber getLandlineNo() {
		return landlineNo;
	}

	public void setLandlineNo(PhoneNumber landlineNo) {
		this.landlineNo = landlineNo;
	}
/*
	public PhoneNumber getMobileNo() {
		return mobileNo;
	}

	public void setMobileNo(PhoneNumber mobileNo) {
		this.mobileNo = mobileNo;
	}
*/

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Address address = (Address) o;

        if (avenue != null ? !avenue.equals(address.avenue) : address.avenue != null) return false;
        if (city != null ? !city.equals(address.city) : address.city != null) return false;
        if (country != null ? !country.equals(address.country) : address.country != null) return false;
        if (doorNo != null ? !doorNo.equals(address.doorNo) : address.doorNo != null) return false;
        if (landlineNo != null ? !landlineNo.equals(address.landlineNo) : address.landlineNo != null) return false;
        if (pin != null ? !pin.equals(address.pin) : address.pin != null) return false;
        if (state != null ? !state.equals(address.state) : address.state != null) return false;
        if (streetName != null ? !streetName.equals(address.streetName) : address.streetName != null) return false;

        return true;
    }

    public int hashCode() {
        int result;
        result = (doorNo != null ? doorNo.hashCode() : 0);
        result = 31 * result + (streetName != null ? streetName.hashCode() : 0);
        result = 31 * result + (avenue != null ? avenue.hashCode() : 0);
        result = 31 * result + (city != null ? city.hashCode() : 0);
        result = 31 * result + (state != null ? state.hashCode() : 0);
        result = 31 * result + (country != null ? country.hashCode() : 0);
        result = 31 * result + (pin != null ? pin.hashCode() : 0);
        result = 31 * result + (landlineNo != null ? landlineNo.hashCode() : 0);
        return result;
    }
}
